package com.liuchuanzheng.lcz_animationdemos.tradition;

import androidx.appcompat.app.AppCompatActivity;

import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;

import com.liuchuanzheng.lcz_animationdemos.R;
import com.liuchuanzheng.lcz_animationdemos.databinding.ActivityAppStartBinding;
import com.liuchuanzheng.lcz_animationdemos.databinding.ActivityFrameAnimationBinding;

public class FrameAnimationActivity extends AppCompatActivity {
    private ActivityFrameAnimationBinding mViewBinding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mViewBinding = ActivityFrameAnimationBinding.inflate(getLayoutInflater());
        setContentView(mViewBinding.getRoot());

        mViewBinding.animation1.setImageResource(R.drawable.frame_anim1);
        AnimationDrawable animationDrawable1 = (AnimationDrawable) mViewBinding.animation1.getDrawable();
        animationDrawable1.start();

        mViewBinding.animation2.setImageResource(R.drawable.frame_anim2);
        AnimationDrawable animationDrawable2 = (AnimationDrawable) mViewBinding.animation2.getDrawable();
        animationDrawable2.start();

        mViewBinding.animation3.setImageResource(R.drawable.frame_anim3);
        AnimationDrawable animationDrawable3 = (AnimationDrawable) mViewBinding.animation3.getDrawable();
        animationDrawable3.start();

        mViewBinding.animation4.setImageResource(R.drawable.frame_anim4);
        AnimationDrawable animationDrawable4 = (AnimationDrawable) mViewBinding.animation4.getDrawable();
        animationDrawable4.start();

    }

    @Override
    public void finish() {
        super.finish();
        overridePendingTransition(0, R.anim.zoomout);
    }
}